/*
 * spi.h
 *
 *  Created on: 2023年2月24日
 *      Author: 15516
 */
#include "hbird_sdk_soc.h"
#ifndef APPLICATION_SPI_H_
#define APPLICATION_SPI_H_



/**SPI1 GPIO Configuration    
    PB15     ------> SPI1_SCK
    PF0     ------> SPI1_MISO
    PF2     ------> SPI1_MOSI 
    */
#define 	SPI_SCK                     (1<<6)
#define 	SPI_MOSI                    (1<<4)
#define 	SPI_MISO                    (1<<5)
#define 	SPI_CS                     	(1<<7)



#define MOSI_H  gpio_write(GPIOA,SPI_MOSI, 1)
#define MOSI_L  gpio_write(GPIOA,SPI_MOSI, 0)
#define SCK_H   gpio_write(GPIOA,SPI_SCK, 1)   
#define SCK_L 	gpio_write(GPIOA,SPI_SCK, 0)  
#define MISO    gpio_read(GPIOA,SPI_MISO)
#define CS_H   	gpio_write(GPIOA,SPI_CS, 1) 
#define CS_L   	gpio_write(GPIOA,SPI_CS, 0)

void SPI_init();
uint8_t SOFT_SPI_RW_MODE0( uint8_t write_dat );




#endif /* APPLICATION_SPI_H_ */
